package com.imooc.netty.ch6;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

/**
 * @author
 */
public class InBoundHandlerB extends ChannelInboundHandlerAdapter {
    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        System.out.println("InBoundHandlerB: " + msg);
        ctx.fireChannelRead(msg);
        //throw new BusinessException("from InBoundHandlerB");
    }
    //@Override
    //public void channelActive(ChannelHandlerContext ctx) throws Exception {
    //    ctx.fireChannelRead("hello worldA");
    //}

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        //super.exceptionCaught(ctx, cause);
        System.out.println("InBoundHandlerB: ");
        ctx.fireExceptionCaught(cause);
    }

    //@Override
    //public void channelActive(ChannelHandlerContext ctx) {
    //    ctx.channel().pipeline().fireChannelRead("hello world");
    //}
}
